
package std.collection

import std.math.*

@!APILevel[
    since: "22"
]
public class ArrayDeque<T> <: Deque<T> {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22"
    ]
    public prop first: ?T
    
    @!APILevel[
        since: "22"
    ]
    public prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addFirst(element: T): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addLast(element: T): Unit
    
    @OverflowWrapping
    @!APILevel[
        since: "22"
    ]
    public func removeFirst(): ?T
    
    @OverflowWrapping
    @!APILevel[
        since: "22"
    ]
    public func removeLast(): ?T
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<T>
    
    @OverflowWrapping
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
}

extend<T> ArrayDeque<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22"
]
public class ArrayList<T> <: List<T> {
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    /**
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> T)
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public init(elements: Collection<T>)
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public static func of(elements: Array<T>): ArrayList<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public unsafe func getRawArray(): Array<T>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func get(index: Int64): ?T
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop first: ?T
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop last: ?T
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<T>): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T, at!: Int64): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<T>, at!: Int64): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(at!: Int64): T
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(range: Range<Int64>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (T) -> Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clear(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortBy(stable!: Bool, comparator!: (T, T) -> Ordering): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, by!: (T, T) -> Ordering, stable!: Bool = false, descending!: Bool = false): Unit` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortBy(comparator!: (T, T) -> Ordering): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reverse(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](range: Range<Int64>): ArrayList<T>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func slice(range: Range<Int64>): ArrayList<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func clone(): ArrayList<T>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](index: Int64): T
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](index: Int64, value!: T): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
}

extend<T> ArrayList<T> <: Equatable<ArrayList<T>> where T <: Equatable<T> {
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public operator func ==(that: ArrayList<T>): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public operator func !=(that: ArrayList<T>): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func contains(element: T): Bool
}

extend<T> ArrayList<T> where T <: Comparable<T> {
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sort(stable!: Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sort(): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortDescending(stable!: Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @Deprecated[message: "Use global function `public func sort<T>(data: ArrayList<T>, stable!: Bool = false, descending!: Bool = false): Unit where T <: Comparable<T>` in std.sort instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sortDescending(): Unit
}

extend<T> ArrayList<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}




@!APILevel[
    since: "22"
]
public class ArrayQueue<T> <: Queue<T> {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    @!APILevel[
        since: "22"
    ]
    public func peek(): ?T
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func remove(): ?T
    
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<T>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
}

extend<T> ArrayQueue<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22"
]
public class ArrayStack<T> <: Stack<T> {
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func peek(): ?T
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(): ?T
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
}

extend<T> ArrayStack<T> <: ToString where T <: ToString {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22"
]
public class ConcurrentModificationException <: Exception {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    @!APILevel[
        since: "22"
    ]
    public init(message: String)
}

@Frozen
@!APILevel[
    since: "22"
]
public func reduce<T>(operation: (T, T) -> T): (Iterable<T>) -> Option<T>

@!APILevel[
    since: "22"
]
public func fold<T, R>(initial: R, operation: (R, T) -> R): (Iterable<T>) -> R

@!APILevel[
    since: "22"
]
public func isEmpty<T>(it: Iterable<T>): Bool

@!APILevel[
    since: "22"
]
public func count<T>(it: Iterable<T>): Int64

@!APILevel[
    since: "22"
]
public func contains<T>(element: T): (Iterable<T>) -> Bool where T <: Equatable<T>

@!APILevel[
    since: "22"
]
public func max<T>(it: Iterable<T>): Option<T> where T <: Comparable<T>

@!APILevel[
    since: "22"
]
public func min<T>(it: Iterable<T>): Option<T> where T <: Comparable<T>

@!APILevel[
    since: "22"
]
public func all<T>(predicate: (T) -> Bool): (Iterable<T>) -> Bool

@!APILevel[
    since: "22"
]
public func any<T>(predicate: (T) -> Bool): (Iterable<T>) -> Bool

@!APILevel[
    since: "22"
]
public func none<T>(predicate: (T) -> Bool): (Iterable<T>) -> Bool

@!APILevel[
    since: "22"
]
public func first<T>(it: Iterable<T>): Option<T>

@!APILevel[
    since: "22"
]
public func last<T>(it: Iterable<T>): Option<T>

@!APILevel[
    since: "22"
]
public func at<T>(n: Int64): (Iterable<T>) -> Option<T>

@!APILevel[
    since: "22"
]
public func forEach<T>(action: (T) -> Unit): (Iterable<T>) -> Unit

@!APILevel[
    since: "22"
]
public class HashMap<K, V> <: Map<K, V> where K <: Hashable & Equatable<K> {
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Collection<(K, V)>)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Array<(K, V)>)
    
    /**
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> (K, V))
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func get(key: K): ?V
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(key: K, value: V): Option<V>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func entryView(key: K): MapEntryView<K, V>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<(K, V)>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(key: K): Option<V>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(all!: Collection<K>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (K, V) -> Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clear(): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(all!: Collection<K>): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(key: K): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func clone(): HashMap<K, V>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func keys(): EquatableCollection<K>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func values(): Collection<V>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](key: K): V
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](key: K, value!: V): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): HashMapIterator<K, V>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<(K, V)>
}

extend<K, V> HashMap<K, V> <: ToString where V <: ToString, K <: ToString {
    /**
    * @throws ConcurrentModificationException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

extend<K, V> HashMap<K, V> <: Equatable<HashMap<K, V>> where V <: Equatable<V> {
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(right: HashMap<K, V>): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(right: HashMap<K, V>): Bool
}

@!APILevel[
    since: "22"
]
public class HashMapIterator<K, V> <: Iterator<(K, V)> where K <: Hashable & Equatable<K> {
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public init(map: HashMap<K, V>)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func next(): ?(K, V)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(): Option<(K, V)>
}

@!APILevel[
    since: "22"
]
public class HashSet<T> <: Set<T> where T <: Hashable & Equatable<T> {
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Collection<T>)
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Array<T>)
    
    /**
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(capacity: Int64)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> T)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(element: T): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func subsetOf(other: ReadOnlySet<T>): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(all!: Collection<T>): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(element: T): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<T>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(all!: Collection<T>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (T) -> Bool): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clear(): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func retain(all!: Set<T>): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clone(): HashSet<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reserve(additional: Int64): Unit
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop capacity: Int64
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func toArray(): Array<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func &(other: ReadOnlySet<T>): HashSet<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func |(other: ReadOnlySet<T>): HashSet<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func -(other: ReadOnlySet<T>): HashSet<T>
}

extend<T> HashSet<T> <: Equatable<HashSet<T>> {
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(that: HashSet<T>): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(that: HashSet<T>): Bool
}

extend<T> HashSet<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22"
]
public class LinkedListNode<T> {
    /**
    * @throws [get|set] IllegalStateException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public mut prop value: T
    
    /**
    * @throws IllegalStateException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop next: Option<LinkedListNode<T>>
    
    /**
    * @throws IllegalStateException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop prev: Option<LinkedListNode<T>>
}

@!APILevel[
    since: "22"
]
public class LinkedList<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Collection<T>)
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Array<T>)
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> T)
    
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop first: ?T
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    public prop firstNode: ?LinkedListNode<T>
    
    @!APILevel[
        since: "22"
    ]
    public prop lastNode: ?LinkedListNode<T>
    
    /**
    * @throws NoneValueException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addFirst(element: T): LinkedListNode<T>
    
    /**
    * @throws NoneValueException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addLast(element: T): LinkedListNode<T>
    
    /**
    * @throws NoneValueException
    * @throws IllegalStateException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toArray(): Array<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addBefore(node: LinkedListNode<T>, element: T): LinkedListNode<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func addAfter(node: LinkedListNode<T>, element: T): LinkedListNode<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(node: LinkedListNode<T>): T
    
    /**
    * @throws IllegalStateException
    * @throws NoneValueException
    * @throws ConcurrentModificationException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (T) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reverse(): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeFirst(): ?T
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeLast(): ?T
    
    /**
    * @throws NoneValueException
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func nodeAt(index: Int64): Option<LinkedListNode<T>>
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func splitOff(node: LinkedListNode<T>): LinkedList<T>
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func forward(mark: LinkedListNode<T>): Iterator<T>
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func backward(mark: LinkedListNode<T>): Iterator<T>
}

extend<T> LinkedList<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

extend<T> LinkedList<T> <: Equatable<LinkedList<T>> where T <: Equatable<T> {
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(right: LinkedList<T>): Bool
    
    /**
    * @throws IllegalStateException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(right: LinkedList<T>): Bool
}

@!APILevel[
    since: "22"
]
public interface ReadOnlyList<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    prop first: ?T
    
    @!APILevel[
        since: "22"
    ]
    prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    func get(index: Int64): ?T
    
    @!APILevel[
        since: "22"
    ]
    operator func [](index: Int64): T
}

@!APILevel[
    since: "22"
]
public interface List<T> <: ReadOnlyList<T> {
    @!APILevel[
        since: "22"
    ]
    func add(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    func add(all!: Collection<T>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func add(element: T, at!: Int64): Unit
    
    @!APILevel[
        since: "22"
    ]
    func add(all!: Collection<T>, at!: Int64): Unit
    
    @!APILevel[
        since: "22"
    ]
    func remove(at!: Int64): T
    
    @!APILevel[
        since: "22"
    ]
    func remove(range: Range<Int64>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func removeIf(predicate: (T) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    func clear(): Unit
    
    @!APILevel[
        since: "22"
    ]
    operator func [](index: Int64, value!: T): Unit
}

@!APILevel[
    since: "22"
]
public interface MapEntryView<K, V> {
    @!APILevel[
        since: "22"
    ]
    prop key: K
    
    @!APILevel[
        since: "22"
    ]
    mut prop value: ?V
}

@!APILevel[
    since: "22"
]
public interface ReadOnlyMap<K, V> <: Collection<(K, V)> {
    @!APILevel[
        since: "22"
    ]
    func get(key: K): ?V
    
    @!APILevel[
        since: "22"
    ]
    func contains(key: K): Bool
    
    @!APILevel[
        since: "22"
    ]
    func contains(all!: Collection<K>): Bool
    
    @!APILevel[
        since: "22"
    ]
    func keys(): EquatableCollection<K>
    
    @!APILevel[
        since: "22"
    ]
    func values(): Collection<V>
    
    @!APILevel[
        since: "22"
    ]
    operator func [](key: K): V
}

@!APILevel[
    since: "22"
]
public interface Map<K, V> <: ReadOnlyMap<K, V> {
    @!APILevel[
        since: "22"
    ]
    func add(key: K, value: V): ?V
    
    @!APILevel[
        since: "22"
    ]
    func add(all!: Collection<(K, V)>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func remove(key: K): Option<V>
    
    @!APILevel[
        since: "22"
    ]
    func remove(all!: Collection<K>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func removeIf(predicate: (K, V) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    func clear(): Unit
    
    @!APILevel[
        since: "22"
    ]
    operator func [](key: K, value!: V): Unit
    
    @!APILevel[
        since: "22"
    ]
    func entryView(k: K): MapEntryView<K, V>
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    func addIfAbsent(key: K, value: V): ?V
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    func replace(key: K, value: V): ?V
}

@!APILevel[
    since: "22"
]
public interface EquatableCollection<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    func contains(element: T): Bool
    
    @!APILevel[
        since: "22"
    ]
    func contains(all!: Collection<T>): Bool
}

@!APILevel[
    since: "22"
]
public interface OrderedMap<K, V> <: Map<K, V> {
    @!APILevel[
        since: "22"
    ]
    prop first: ?(K, V)
    
    @!APILevel[
        since: "22"
    ]
    prop last: ?(K, V)
    
    @!APILevel[
        since: "22"
    ]
    func removeFirst(): ?(K, V)
    
    @!APILevel[
        since: "22"
    ]
    func removeLast(): ?(K, V)
    
    @!APILevel[
        since: "22"
    ]
    func backward(mark: K, inclusive!: Bool): Iterator<(K, V)>
    
    @!APILevel[
        since: "22"
    ]
    func forward(mark: K, inclusive!: Bool): Iterator<(K, V)>
}

@!APILevel[
    since: "22"
]
public func enumerate<T>(it: Iterable<T>): Iterator<(Int64, T)>

@Frozen
@!APILevel[
    since: "22"
]
public func filter<T>(predicate: (T) -> Bool): (Iterable<T>) -> Iterator<T>

@!APILevel[
    since: "22"
]
public func filterMap<T, R>(transform: (T) -> ?R): (Iterable<T>) -> Iterator<R>

@Frozen
@!APILevel[
    since: "22"
]
public func map<T, R>(transform: (T) -> R): (Iterable<T>) -> Iterator<R>

@!APILevel[
    since: "22"
]
public func flatten<T, R>(it: Iterable<T>): Iterator<R> where T <: Iterable<R>

@!APILevel[
    since: "22"
]
public func flatMap<T, R>(transform: (T) -> Iterable<R>): (Iterable<T>) -> Iterator<R>

@!APILevel[
    since: "22"
]
public func zip<T, R>(other: Iterable<R>): (Iterable<T>) -> Iterator<(T, R)>

@Frozen
@!APILevel[
    since: "22"
]
public func concat<T>(other: Iterable<T>): (Iterable<T>) -> Iterator<T>

/**
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func skip<T>(count: Int64): (Iterable<T>) -> Iterator<T>

/**
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func take<T>(count: Int64): (Iterable<T>) -> Iterator<T>

/**
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func step<T>(count: Int64): (Iterable<T>) -> Iterator<T>

@!APILevel[
    since: "22"
]
public func inspect<T>(action: (T) -> Unit): (Iterable<T>) -> Iterator<T>

@!APILevel[
    since: "22"
]
public interface Deque<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    prop first: ?T
    
    @!APILevel[
        since: "22"
    ]
    prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    func addFirst(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    func addLast(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    func removeFirst(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func removeLast(): ?T
}

@!APILevel[
    since: "22"
]
public interface Queue<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    func add(element: T): Unit
    
    @!APILevel[
        since: "22"
    ]
    func peek(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func remove(): ?T
}

@!APILevel[
    since: "22"
]
public interface ReadOnlySet<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    func contains(element: T): Bool
    
    @!APILevel[
        since: "22"
    ]
    func contains(all!: Collection<T>): Bool
    
    @!APILevel[
        since: "22"
    ]
    func subsetOf(other: ReadOnlySet<T>): Bool
}

@!APILevel[
    since: "22"
]
public interface Set<T> <: ReadOnlySet<T> {
    @!APILevel[
        since: "22"
    ]
    func add(element: T): Bool
    
    @!APILevel[
        since: "22"
    ]
    func add(all!: Collection<T>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func remove(element: T): Bool
    
    @!APILevel[
        since: "22"
    ]
    func remove(all!: Collection<T>): Unit
    
    @!APILevel[
        since: "22"
    ]
    func removeIf(predicate: (T) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    func clear(): Unit
    
    @!APILevel[
        since: "22"
    ]
    func retain(all!: Set<T>): Unit
}

@!APILevel[
    since: "22"
]
public interface OrderedSet<T> <: Set<T> {
    @!APILevel[
        since: "22"
    ]
    prop first: ?T
    
    @!APILevel[
        since: "22"
    ]
    prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    func removeFirst(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func removeLast(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func backward(mark: T, inclusive!: Bool): Iterator<T>
    
    @!APILevel[
        since: "22"
    ]
    func forward(mark: T, inclusive!: Bool): Iterator<T>
}

@!APILevel[
    since: "22"
]
public interface Stack<T> <: Collection<T> {
    @!APILevel[
        since: "22"
    ]
    func peek(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func remove(): ?T
    
    @!APILevel[
        since: "22"
    ]
    func add(element: T): Unit
}

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func collectString<T>(delimiter!: String = ""): (Iterable<T>) -> String where T <: ToString

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func collectArray<T>(it: Iterable<T>): Array<T>

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func collectArrayList<T>(it: Iterable<T>): ArrayList<T>

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func collectHashSet<T>(it: Iterable<T>): HashSet<T> where T <: Hashable & Equatable<T>

/**
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@Frozen
@!APILevel[
    since: "22",
    throwexception: true
]
public func collectHashMap<K, V>(it: Iterable<(K, V)>): HashMap<K, V> where K <: Hashable & Equatable<K>

@!APILevel[
    since: "22"
]
public class TreeMap<K, V> <: OrderedMap<K, V> where K <: Comparable<K> {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Collection<(K, V)>)
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Array<(K, V)>)
    
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> (K, V))
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func get(key: K): ?V
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(key: K): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(all!: Collection<K>): Bool
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(key: K, value: V): Option<V>
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<(K, V)>): Unit
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(key: K): Option<V>
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(all!: Collection<K>): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (K, V) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clone(): TreeMap<K, V>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](key: K): V
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func [](key: K, value!: V): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func keys(): EquatableCollection<K>
    
    @!APILevel[
        since: "22"
    ]
    public func values(): Collection<V>
    
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    /**
    * @throws NoneValueException
    */
    @Frozen
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func iterator(): Iterator<(K, V)>
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop first: ?(K, V)
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeFirst(): ?(K, V)
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop last: ?(K, V)
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeLast(): ?(K, V)
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func backward(mark: K, inclusive!: Bool = true): Iterator<(K, V)>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func forward(mark: K, inclusive!: Bool = true): Iterator<(K, V)>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func entryView(k: K): MapEntryView<K, V>
}

extend<K, V> TreeMap<K, V> <: ToString where V <: ToString, K <: ToString & Comparable<K> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

extend<K, V> TreeMap<K, V> <: Equatable<TreeMap<K, V>> where V <: Equatable<V> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(right: TreeMap<K, V>): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(right: TreeMap<K, V>): Bool
}

@!APILevel[
    since: "22"
]
public class TreeSet<T> <: OrderedSet<T> where T <: Comparable<T> {
    @!APILevel[
        since: "22"
    ]
    public prop size: Int64
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop first: ?T
    
    /**
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop last: ?T
    
    @!APILevel[
        since: "22"
    ]
    public init()
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(elements: Collection<T>)
    
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(size: Int64, initElement: (Int64) -> T)
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func of(elements: Array<T>): TreeSet<T>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(element: T): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func contains(all!: Collection<T>): Bool
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(element: T): Bool
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func add(all!: Collection<T>): Unit
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(element: T): Bool
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func remove(all!: Collection<T>): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeIf(predicate: (T) -> Bool): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func clear(): Unit
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clone(): TreeSet<T>
    
    @!APILevel[
        since: "22"
    ]
    public func isEmpty(): Bool
    
    @Frozen
    @!APILevel[
        since: "22"
    ]
    public func iterator(): Iterator<T>
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeFirst(): ?T
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeLast(): ?T
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func backward(mark: T, inclusive!: Bool = true): Iterator<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws NoneValueException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func forward(mark: T, inclusive!: Bool = true): Iterator<T>
    
    /**
    * @throws IllegalArgumentException
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws ConcurrentModificationException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func retain(all!: Set<T>): Unit
    
    @!APILevel[
        since: "22"
    ]
    public func toArray(): Array<T>
    
    @!APILevel[
        since: "22"
    ]
    public func subsetOf(other: ReadOnlySet<T>): Bool
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func &(other: ReadOnlySet<T>): TreeSet<T>
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func |(other: ReadOnlySet<T>): TreeSet<T>
    
    /**
    * @throws NoneValueException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func -(other: ReadOnlySet<T>): TreeSet<T>
}

extend<T> TreeSet<T> <: Equatable<TreeSet<T>> {
    @!APILevel[
        since: "22"
    ]
    public operator func ==(that: TreeSet<T>): Bool
    
    @!APILevel[
        since: "22"
    ]
    public operator func !=(that: TreeSet<T>): Bool
}

extend<T> TreeSet<T> <: ToString where T <: ToString {
    /**
    * @throws NoneValueException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

